package br.inf.solutions.apresentacoes.ssp.control.report;

import java.io.File;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;

@Service
@Scope("prototype")
public class BulletinReportGenerator extends BaseReportGenerator {

	final String PATH_INDIVIDUAL_RECORD = "bulletin";
	final String NAME_REPORT_INDIVIDUAL_RECORD = "bulletin.jrxml";
	
	private static final String TEMPLATES_PATH = "C:" + File.separator + "Applications" + File.separator + "hierarquias" + File.separator + "relatorios" + File.separator;
	
	@SuppressWarnings("unchecked")
	@Override
	protected JasperReportBuilder buildReport() {
		pathTemplate = TEMPLATES_PATH + File.separator + PATH_INDIVIDUAL_RECORD + File.separator + NAME_REPORT_INDIVIDUAL_RECORD;
		
//		Person person = (Person) entity;
//		String name = person.getPost().getAcronym() + " " + person.getSquare().getAcronym() + " " + person.getFullName();
//		
//		titleReport = reportConfig.getKey("INDIVIDUAL_RECORD_TITLE" + name);
		
		String sqlAux = "select * from bulletin";
		params.put("imagePath", "C:" + File.separator + "Applications" + File.separator + "hierarquias" + File.separator + "relatorios" + File.separator + "bulletin" + File.separator + "LOGO_PMDF.jpg");
		
		report = createReport(listReport, params, true, false,
				pathTemplate, false, false, false, "createHeaderReport", "createFooterReport",
				"createTitleReport", sqlAux);
		
		return report;
	}
	
}
